<?php include "coresection/connection.php";?>
<?php include "coresection/checkUserSession.php";?>
<?php include "coresection/order-list.php";?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <?php include 'modules/head.php'; ?>
</head>

<body>
<?php include 'modules/topbar.php'; ?>

<div class="header order_list">
    <h1>欢迎使用订餐系统</h1>

    <div class="user_message">
        当前用户：<?php echo $user_name ?>  <?php echo $user_id ?> [<?php echo $department ?>]　
        <span style=" margin-left: 15px;">日期：<?php echo $todayDate?> <?php echo $weekDate?></span>
    </div>


    <?php if($balance < 5){ ?>
        <span class="message">
            温馨提示：您账号所剩余额已经少于五元，已经不能点餐，请快充值。
        </span>
    <? } ?>

</div>


<div class="main order_main" style="width: 1000px;">
    <div class="left_area">
<!--        <span>今日--><?php //echo $todayDate?><!-- --><?php //echo $weekDate?><!--</span><br>-->
        <ul class="date_area">
            <li class="breakfast_list">
                <p>早餐</p>
                <ol class="order_list_ol">
                
<!--  修改循环至9，原数字为6，满足一周,对应order-list.php40行-->
                    <?php for($i=0;$i<9;$i++){?>
                        <?if($i==0&&date('H.i',time())>18){}else{?>
                        <li class="week_<?echo $listWeekNum[$i]?>_1" data-date="<?echo $list_Date[$i]?>" data-date2="<?echo $listDate[$i]?>" data-date3="<?echo $list_Date_m[$i]?>"> <?echo $listDate[$i]?> <?echo $listWeek[$i]?></li>
                        <?}?>
                    <? } ?>
                </ol>
            </li>
            <li class="lunch_list">
                <p style="background: #f0e68c">午餐</p>
                <ol class="order_list_ol">
                    <?php for($i=0;$i<9;$i++){?>
                        <?if($i==0&&date('H.i',time())>18){}else{?>
                        <li class="week_<?echo $listWeekNum[$i]?>_2" data-date="<?echo $list_Date[$i]?>" data-date2="<?echo $listDate[$i]?>"  data-date3="<?echo $list_Date_m[$i]?>" ><?echo $listDate[$i]?> <?echo $listWeek[$i]?></li>
                        <?}?>
                    <? } ?>
                </ol>
            </li>
            <li class="dinner_list">
                <p style="background: #25abcd">晚餐</p>
                <ol class="order_list_ol">
                    <?php for($i=0;$i<9;$i++){?>
                        <?if($i==0&&date('H.i',time())>18){}else{?>
                        <li class="week_<?echo $listWeekNum[$i]?>_3" data-date="<?echo $list_Date[$i]?>" data-date2="<?echo $listDate[$i]?>"  data-date3="<?echo $list_Date_m[$i]?>"><?echo $listDate[$i]?> <?echo $listWeek[$i]?></li>
                        <?}?>
                    <? } ?>
                </ol>
            </li>
        </ul>
		 
		
    </div>


    <form id="orderForm" action="" method="" autocomplete="off" enctype="multipart/form-data"  class="layui-form" style="width: 640px; float: left; text-align: left;">
        <div class="right_area status-date" style="margin-left:0;">
            <p>
                <b>当前账户金额：</b><?php echo $balance ?>元<input type="hidden" value="<?php echo $balance ?>" class="balance"/><br>
                <b>当前交易金额：</b><b class="orderPrice">0</b>元<input type="hidden" value="0" class="order_price"/><br>
<!--                <b>当前可用余额：</b> --><?php //echo $balance ?><!-- 元-->
            </p>

        </div>
        <div class="center_area">

		</div>






        <div class="layui-form-item" >
<div class="tips">
            请根据实际情况勾选，网点就餐的请选择配送，饭堂就餐的请选择堂食。
        </div>
            <label class="layui-form-label">就餐地点</label>
            <div class="layui-input-block">
                <input type="radio" id="nodiliver" name="diliver"  value="堂食" title="堂食">
                <input type="radio" id="diliver" name="diliver"  value="配送" title="配送" >
            </div>
        </div>



        <div style="width: 640px; float: left; text-align: left;">


            <span class="layui-btn layui-btn-big orderSub button" style="float:left;">下订</span>

        </div>


    </form>
</div>




<div class="confirm" style="width:1000px;margin:25px auto">
    <h2><a href="setup_summary.php"  class="button layui-btn layui-btn-big">退订</a>订餐记录</h2>
    <div class="line_solid"></div>

        <div class="table_area">




            <div class="layui-form">
                <table class="layui-table">
                    <colgroup>
                        <col  >
                        <col  >
                        <col  >
                        <col  >
                        <col>
                        <col>
                    </colgroup>
                    <thead>
                    <tr>
                        <th>预订日期</th>
                        <th>类型</th>
                        <th>菜名</th>
                        <th>数量</th>
                        <th>总价</th>
                    </tr>
                    </thead>
                    <tbody>
                    <!--原本设置数值未 $sumOrder 显示所有订单，后来我改成最近订单100条信息-->
                    <?

                    if($sumOrder>10)
                    {
                        $sumOrder=10;
                    }

                    for($i=0;$i<$sumOrder;$i++){?>
                        <tr>
                            <td>
                                <strong><? echo  $i+1 ?></strong> /
                                <?echo $order_date[$i]?>



                                <?
                                $temp  = str_replace("年","-",$order_date[$i]);
                                $temp1 = str_replace("月","-",$temp);
                                $temp2 = str_replace("日","",$temp1);

                                $theday=$temp2." 00:00:30";



                                switch(date( "w ",strtotime($theday))){
                                    case 0:
                                        echo "星期日";
                                        break;
                                    case 1:
                                        echo "星期一";
                                        break;
                                    case 2:
                                        echo "星期二";
                                        break;
                                    case 3:
                                        echo "星期三";
                                        break;
                                    case 4:
                                        echo "星期四";
                                        break;
                                    case 5:
                                        echo "星期五";
                                        break;
                                    case 6:
                                        echo "星期六";
                                        break;
                                }
                                ?>
                            </td>
                            <td>
                                <?
                                switch($order_at[$i]){
                                    case 1:
                                        echo "早餐";
                                        break;
                                    case 2:
                                        echo "午餐";
                                        break;
                                    case 3:
                                        echo "晚餐";
                                        break;
                                }
                                ?>
                            </td>
                            <td><?echo $product_name[$i]?></td>
                            <td> <?echo $product_numsum[$i]?> </td>
                            <td><?echo $order_price[$i]?></td>
                        </tr>
                    <?}?>

                    </tbody>
                </table>
            </div>






        </div>
</div>

<br />
<br />
<br />

<?php include 'modules/footer.php'; ?>
</body>
</html>
